package cn.edu.scau.cmi.liangzijian.composite.safe;

public class SafeTreeDisplayer {
	
	static public void display(SafeOrganization sm, SafeOrganization target, int level) {
		for(int i = 0; i < level; i++) 
			System.out.print((i == 0 ? "|" : "  |"));	
		
		System.out.print("—— ");
		if(!sm.getName().equals("root"))
			System.out.print(sm.getName());
		if(sm == target)
			System.out.print("←");
		System.out.println();
		
		if(sm instanceof SafeTeam) {	
			for(SafeOrganization m : ((SafeTeam)sm).getMemberList()) {
				display(m, target, level+1);
			} 
		}

	}
}
